set(project_name MainSource)

find_package(Qt5 COMPONENTS Widgets Core Gui Sql Svg Qml QUick REQUIRED)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

file(GLOB SOURCES
    "*.cpp"
    "*.c"
    "*.hpp"
    "*.cxx"
    )

file(GLOB HEADERS
    "*.h"
    "*.hxx"
    )

file(GLOB UI_FILES
    "*.ui"
    )

file(GLOB UI_QRC
    "*.qrc"
    )
qt5_wrap_ui(wrap_ui_file ${UI_FILES})
qt5_add_resources(QRC_FILES ${UI_QRC})

# 生成UI文件夹
SOURCE_GROUP("UI" FILES ${UI_FILES} ${wrap_ui_file} )

add_executable(${project_name}
#WIN32
    ${SOURCES} 
    ${HEADERS} 
    ${UI_FILES} 
    ${QRC_FILES}
    ${wrap_ui_file}
)


# 链接Qt库
target_link_libraries(${project_name} 
	Qt5::Widgets
	Qt5::Core
    SharedTemplates
    WorkspaceArea
    WidgetCreator
    MessageBus
    Subjects
)
link_directories (${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG})
link_directories (${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE})

add_subdirectory(LoginWidget)
add_subdirectory(Subjects)


